package name.elftesting.vncelf;

import java.awt.*;

import javax.swing.*;

/**
 * 
 * @author Xiaoping Wu
 * 
 */
public class ImageJPanel extends JPanel {
	private Image image;

	public ImageJPanel(Image image) {
		this.image = image;
		Dimension size = new Dimension(image.getWidth(null),
				image.getHeight(null));
		setSize(size);
		setPreferredSize(size);
		setMaximumSize(size);
		setMinimumSize(size);
	}

	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		g.drawImage(image, 0, 0, null);
	}

	public static void main(String[] args) {
		ImageJPanel imageJP = new ImageJPanel(
				new ImageIcon("images/launch.jpg").getImage());
		JFrame jf = new JFrame();
		jf.add(imageJP);
		jf.setSize(imageJP.getWidth(), imageJP.getHeight() + 35);
		jf.setVisible(true);
	}
}
